<?php

namespace app\models;

use think\Model;

/**
 * Class RemedialModel
 * @package app\models
 */
class RemedialModel extends Model
{
    protected $table = 'edu_remedial';

    /**
     * @param $param
     *
     * @throws \think\exception\DbException
     *
     * @return array
     */
    public function getRemedialLists($param)
    {
        $page = isset($param['page']) ? (int) $param['page'] : 1;
        $listRows = isset($param['limit']) ? (int) $param['limit'] : 10;
        $where = [];
        if (isset($param['campus_name']) && '' !== $param['campus_name']) {
            $where['campus_name'] = ['like', $param['campus_name'].'%'];
        }
        $listData = self::where($where)
            ->paginate($listRows, false, ['page' => $page])
            ->toArray();
//        if (!empty($listData)) {
//            foreach ($listData['data'] as &$item) {
//                $campusPriceConfigure = CampusPriceConfigureModel::get(['campus_id' => $item['id']]);
//                if ($campusPriceConfigure && isset($param['course_id'])) {
//                    $item['campus_price'] = CampusPriceConfigureModel::getById($item['id'], $param['course_id'], 'price');
//                }
//                $item['status_text'] = (1 === $item['status']) ? '启用' : '禁用';
//            }
//        }
        return $listData;
    }
}
